//HouseDemoScene.h
//Created 12/05/14
//Created By Daniel Bowler
//
//An internal scene for private use to demonstrate some advanced rendering
//effects. (Much like the GL Demo I have). I may choose to have multiple of these
//in the game depending on how many things I want to show off. 
//
//We will transition to these scenes from houses dotted around the scene. 

#pragma once

//This scene is a standard scene and inherits from AbstractScene
//so it will work with our current scene management system
#include "AbstractScene.h"

//Number of point/spot lights. 
#define HOUSE_DEMO_SCENE_ONE_NUM_LIGHTS 100

//MSAA State for this scene? Comment to turn it off, uncomment to turn on.
#define HOUSE_DEMO_SCENE_ONE_SCENE_ENABLE_MSAA

//Forward declare the advanced models we use. 
class SkyDome;

class HouseDemoSceneOne : public AbstractScene
{
public: 
	//Constructor and Destructor. Constructor will be used
	//to init the classes variables (and any pointers to NULL) but leave
	//dynamic allocation to the InitDynamicData() - unless absolutly required
	HouseDemoSceneOne();
	~HouseDemoSceneOne();

	//Override the init and dealloc functions
	void OpenScene();
	void CloseScene();

	//Override the mouse input functions
	void OnMouseDown(WPARAM btnState, int x, int y, UINT originalMessage);
	void OnMouseUp(WPARAM btnState, int x, int y, UINT originalMessage);
	void OnMouseMove(WPARAM btnState, int x, int y);

	//Override OnResize function. 
	void OnResize();

	//Override the render and update functions
	void UpdateWithDelta(float delta);
	void RenderScene();

private:
	//Scene States.
	enum SceneState 
	{ 
		SCENE_STATE_DRAW_SCENE,						//Draws as usual
		SCENE_STATE_DRAW_Z_PRE_PASS_DEPTH_BUFFER,   //Draws depth buffer as full screen quad.
		SCENE_STATE_DRAW_CS_MAX_Z_DEPTH_BUFFER,     //(Optional) Draws tile max z Buffer.
		SCENE_STATE_DRAW_CS_LLSEB_GREYSCALE,		//Visualise how many lights affect a tile. 
		SCENE_STATE_DRAW_CS_LLSEB_COLOUR,           //As above, but with more colour.
		SCENE_STATE_DRAW_CS_LLSEBT_GREYSCALE,       //Transparant tiles - greyscale.
		SCENE_STATE_DRAW_CS_LLSEBT_COLOUR,			//Transparant tiles - colour
		SCENE_STATE_DRAW_SSAO_VIEW_NORMALS,			//Draws view space normal tex (SSAO)
		SCENE_STATE_DRAW_SSAO_VIEW_DEPTHS,			//Draws view space depths (SSAO)
		SCENE_STATE_DRAW_SSAO_MAP,					//Draws SSAOMap.   
		SCENE_STATE_DRAW_SHADOW_DEPTH,				//Draws shadow map DSV 
	};

private:
	//Scene State - what to render?
	SceneState sceneState;

	//Should render lights?
	bool shouldRenderLights;

private:
	//Direc light
	DirectionalLight dLight;

private:
	//SkyDome
	SkyDome* skyDome;

private:
	//Our floor / wall models
	StaticModel* floor;
	StaticModel* roof;

	//Back wall has a hole in it. (They differ in size, so use the
	//StaticModel rather than instanced models)
	StaticModel* backWall[4];

	StaticModel* frontWall;
	StaticModel* leftWall;
	StaticModel* rightWall;

	//Box in the middle
	StaticModel* box;

	//Collumns around the 4 corners. 
	StaticInstancedModel* collumns;

private:
	//Load the our game models. 
	void LoadModels();

	//Load the SkyDome (and set)
	void LoadSkyDome();

private:
	//Load initial lighting data (point, spot)
	void InitLighting();
	//Init Direc light
	void InitDirecLight();
	//Inits hemispherial ambient light
	void InitHemisphericalAmbientLight();

private:
	//Loads room walls/floor
	void LoadFloor();
	void LoadRoof();
	void LoadBackWall();
	void LoadFrontWall();
	void LoadLeftWall();
	void LoadRightWall();

	//Load NM box in the middle
	void LoadBox();

	//Load NM collumns
	void LoadCollumns();
};